package com.sxyh;

import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;

import java.net.MalformedURLException;

public class XMLTest {


    public static void main(String[] args) throws DocumentException, MalformedURLException {
        String xml = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:esb=\"http://esb.soa.sxccb.com\"><soapenv:Header xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:esb=\"http://esb.soa.sxccb.com\"><esb:RequestEsbHeader><esb:Service>PEQ0102</esb:Service><esb:Operation>processRequest</esb:Operation><esb:RequestSystemID>MBK</esb:RequestSystemID><esb:RequestSubsystemID>SVR</esb:RequestSubsystemID><esb:Version>1.0</esb:Version><esb:RequestSystemTime>100552</esb:RequestSystemTime><esb:RequestSystemDate>20210810</esb:RequestSystemDate><esb:UserReferenceNo>MBK2021081010045012</esb:UserReferenceNo><esb:SystemReferenceNo>MBK2021081010055255</esb:SystemReferenceNo></esb:RequestEsbHeader></soapenv:Header><soapenv:Body xmlns:esb=\"http://esb.soa.sxccb.com\"><input><legalBankMark>1</legalBankMark><resolveType>2</resolveType><custNo>210208903</custNo><certType>B</certType><certNo>330602197709305025</certNo></input></soapenv:Body></soapenv:Envelope><?xml version=\"1.0\" encoding=\"UTF-8\"?><soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"><soapenv:Header><esb:ResponseEsbHeader xmlns:esb=\"http://esb.soa.sxccb.com\"><esb:UserReferenceNo>MBK2021081010045012</esb:UserReferenceNo><esb:SystemReferenceNo>MBK2021081010055255</esb:SystemReferenceNo><esb:ResponseCode>ESB000</esb:ResponseCode><esb:ResponseMessage>ESB SUCCESS</esb:ResponseMessage><esb:ResponseSystemDate>20210810</esb:ResponseSystemDate><esb:ResponseSystemTime>095001</esb:ResponseSystemTime></esb:ResponseEsbHeader></soapenv:Header><soapenv:Body><response><ret><success>true</success><retCd>000000</retCd><retMsg>交易成功</retMsg></ret><output><custNo>210208903</custNo><custName>邵国娟</custName><certType>B</certType><certNo>330602197709305025</certNo><certEffectiveDate>20101030</certEffectiveDate><certExpiryDate>20301030</certExpiryDate><issuedAreaCode1>3370</issuedAreaCode1><custStatus>0</custStatus><depositType>01</depositType><sex>2</sex><birthDate>19770930</birthDate><ethnic>01</ethnic><nation>156</nation><prfssn>80000</prfssn><prfssnDesc>反反复复发</prfssnDesc><ischnflag>01</ischnflag><potCustFlag>0</potCustFlag><createdOrg>0924</createdOrg><createdTeller>Y0924</createdTeller><openDate>20210720</openDate><imageId>MBK2021081009020373</imageId><identityVerification>1</identityVerification><taxResType>Y</taxResType><taxCertityType>0</taxCertityType><lastUpdatedOrg>0923</lastUpdatedOrg><lastUpdatedTe>Y0923</lastUpdatedTe><lastUpdatedTs>2021-08-10 09:02:03</lastUpdatedTs><addrList><addr><addrId>30710000000002542401</addrId><addrType>101</addrType><addrLine>上上上上上上上上上</addrLine><initSystemId>FCR</initSystemId><lastUpdatedTs>2021-08-10 09:02:03</lastUpdatedTs></addr><addr><addrId>30710000000002542402</addrId><addrType>106</addrType><addrLine>浙江省绍兴市越城区白马新村２３幢４０６室</addrLine><initSystemId>FCR</initSystemId><lastUpdatedTs>2021-08-10 09:02:03</lastUpdatedTs></addr></addrList><phoneList><phone><telId>30910000000002287301</telId><telType>101</telType><telephone>13105751166</telephone><initSystemId>FCR</initSystemId><lastUpdatedTs>2021-08-10 09:02:03</lastUpdatedTs></phone><phone><telId>30910000000002287302</telId><telType>102</telType><telephone>13105751133</telephone><initSystemId>FCR</initSystemId><lastUpdatedTs>2021-08-10 09:02:03</lastUpdatedTs></phone></phoneList></output></response></soapenv:Body></soapenv:Envelope>";

        Element root = XmlUtil.readTextAsElement(xml);
        Document document = XmlUtil.readText(xml);
        Element rootElement = document.getRootElement();
        Element body = rootElement.element("soapenv:Body");
        String test = rootElement.elementText("soapenv:Body");


        System.out.println(test);

        //FCR_ENCRYPT_FLAG=true
        //FCR_ENCRYPT_URL=http://172.28.23.42:22300
        //FCR_ENCRYPT_AK=1x544UILyPGxFlH9
        //FCR_ENCRYPT_SK=v82wtUlQtGFtB61p
        //FCR_ENCRYPT_KID=SXCCB.FCR.zek

    }
}